net/vnstat: enable auto-respawn when vnstatd crashes
authorMartin Blumenstingl <[email protected]>
Sun, 23 Jul 2017 10:01:10 +0000 (12:01 +0200)
committerMartin Blumenstingl <[email protected]>
Thu, 31 May 2018 11:03:38 +0000 (13:03 +0200)
Originally this was indended as a fix for devices without RTC support
which do not have the correct time set after a reboot (until ntp is able
to update the system time). vnstat checks if there is a time difference
between the latest entry in the database and detects that the system time
is incorrect. In this case vnstat does not start (to prevent database
corruption), the following message is reported instead:
'Error: Interface "..." has previous update date too much in the future,
exiting.'
Once we have network connectivity (and ntp has updated the system time)
vnstat starts correctly though.
vnstat 1.18 fixes this by waiting a few minutes (instead of exiting) and
the following message is logged:
"Latest database update is in the future (db: 2018-04-28 08:39:11 > now:
2018-04-28 08:07:18). Giving the system clock up to 5 minutes to sync
before continuing."

This still adds a procd respawn trigger to let procd automatically
restart vnstat in case:
- vnstat it crashes
- no valid system time is received for a long time (no network
  connectivity, broken NTP servers, ...)

Signed-off-by: Martin Blumenstingl <[email protected]>
net/vnstat/Makefile
net/vnstat/files/vnstat.init

index 1a526fd92efb11acfab01e5a99e3c05380710878..e69b5b036727652e952b05a0b5da2f888dd8be8c 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=vnstat
 PKG_VERSION:=1.18
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://humdi.net/vnstat
index cc9cdc7cc17ab4b6a337834bacd827b388050f75..bfd99f8ae1e4bc778e993cbf59467b034f92608e 100644 (file)
@@ -73,6 +73,7 @@ start_service() {
        procd_set_param stderr 1
        procd_set_param command /usr/sbin/vnstatd --nodaemon
        procd_set_param file /etc/vnstat.conf
+       procd_set_param respawn
        procd_close_instance
 }